<template>
  <div>
      基金
      <button @click="get">本页请求</button>

      <!-- <button @click="get">get</button> -->
      <button @click="test">test</button>
      <div>getData:{{data}}</div>
      <div>testData{{data2}}</div>
      <button @click="fetch">fetch</button>
      <div>fetchData:{{fetchData}}</div>
      <input type="text" v-model="test"/>
      <div>test{{testData}}</div>
    


  </div>
</template>

<script>
import {test} from '@/api/api.js'
export default {
    data() {
        return{
            data:[],
            data2:[],
            fetchData:'',
            test:[1,2,3,4],
            keepdata:1
        }
    },
    mounted() {
        console.log(this.$watch)
        // this.test[3] = 5
        this.$set(this.test, 3, 5)
    },
    computed:{
        testData:function (){
            return this.test
        }
    },
    methods:{
        keepdatachage(data) {
            this.keepdata  = data
        },
        fetch() {
            let url = '/api/fund/get_fund_list/'
            fetch(url,{
                body:JSON.stringify({"page":1}),
                method:'post'
            })
            .then(res => {
                console.log(res)
                return res.json()
            })
            .catch(err => {
                console.log(err)
            })
            .then(res => {
                console.log(res)
            })
        },
        gets() {
            this.$axios.get("http://47.108.25.113:8080/api/fund/get_fund_list/",{"page":1})
            .then(res => {
                console.log(res)
                this.data = res
            })
            .catch(err => {
                console.log(err)
            })
        },
        get() {
            // https://service.swisschina.cn/testcrt/product/recommend_product/
            this.$axios.post("/api/fund/get_fund_list/",{"page":1})
            .then(Response => {
            console.log(Response);
            this.data = Response
            })
            .catch(e => {
                this.data = e
                console.log(e)
            });

        },
        test(){
            test({"page":1})
            .then(res => {
                console.log(res)
                this.data2 = res
            })
            .catch(e => {
                console.log(e)
                this.data2 = e

            })
        }
    }

}
</script>

<style lang="less" scoped>
@redc: red;
.lesstest{
    color: @redc;
}
</style>
